package cn.edu.hqu.javae;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import cn.edu.hqu.javae.domain.Course;
import cn.edu.hqu.javae.domain.Course.Type;
import cn.edu.hqu.javae.repository.CourseRepository;

@SpringBootApplication
public class Lzw3Application {

	public static void main(String[] args) {
		SpringApplication.run(Lzw3Application.class, args);
	}
	@Bean
	public CommandLineRunner dataLoader(CourseRepository repo) {
		return new CommandLineRunner() {

			@Override
			public void run(String... args) throws Exception {
			     repo.save(  new Course("软件工程", "软件工程", Type.SPECIALIZED));
			     repo.save( new Course("数据库", "数据库", Type.SPECIALIZED));
			     repo.save( new Course("数据结构", "数据结构", Type.OPTIONAL));
			     repo.save( new Course("高等代数", "高等代数", Type.OPTIONAL));
				
			}
		
		};
	}
}